<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('入库端提伸机监控')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <!--    <link rel="stylesheet" type="text/css" href="/css/bootstrap-switch.min.css">-->
</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row col-sm-12" style="height: 50%">
            <div id="div1" style="height: 50%;width: 100%" >
                <table id="bootstrap-table1" class="col-sm-5 select-table"></table>
            </div>
            <div id="div2" style="height: 49%;width: 100%" >
                <table id="bootstrap-table2" class="col-sm-5 select-table"></table>
            </div>

        </div>
        <div class="row col-sm-12" style="height: 50%;width: 49%">
            <div id="div3" style="height: 100%;width: 100%" >
                <table id="bootstrap-table3" class="col-sm-5 select-table"></table>
            </div>
        </div>
        <div class="row col-sm-12" style="height: 50%;width: 49%">
            <div id="div4" style="height: 100%;width: 100%" >
                <table id="bootstrap-table4" class="col-sm-5 select-table"></table>
            </div>
        </div>

    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>

<script th:inline="javascript">

    var prefix = ctx + "deviceInfoRk";
    var errRgvDatas = [[${@dict.getType('rgv_err_msg')}]];
    var errTsjDatas = [[${@dict.getType('tsj_err_msg')}]];

    //页面加载完成后执行
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 85});
        // 回到顶部绑定
        if ($.fn.toTop !== undefined) {
            var opt = {
                win: $('.ui-layout-center'),
                doc: $('.ui-layout-center')
            };
            $('#scroll-up').toTop(opt);
        }
        // queryUserList();
        queryUserList1();
        queryUserList2();
        queryUserList3();
        queryUserList4();
        reloadTable();
    });

    function reloadTable() {
        // $('#bootstrap-table').bootstrapTable('refresh');
        $('#bootstrap-table1').bootstrapTable('refresh');
        $('#bootstrap-table2').bootstrapTable('refresh');
        $('#bootstrap-table3').bootstrapTable('refresh');
        $('#bootstrap-table4').bootstrapTable('refresh');
        setTimeout(reloadTable, 3 * 1000);
    }

    // function queryUserList() {
    //
    //     var options = {
    //         url: prefix + "/list43",
    //         height: $("#div").height() / 1,
    //         sortName: "id", //排序字段
    //         sortOrder: "asc",   //排序规则
    //         modalName: "输送机",
    //         columns: [
    //             // 		{
    //             // 	checkbox: true
    //             // },
    //             {
    //                 field: 'devName',
    //                 title: '设备名字 '
    //             },
    //             {
    //                 field: 'taskNo',
    //                 title: '任务号',
    //                 sortable: true
    //             },
    //             {
    //                 field: 'dw',
    //                 title: '到位',
    //                 sortable: true,
    //                 formatter: function (value, row, index) {
    //                     if (value == 0) {
    //                         return "未到位";
    //                     } else if (value == 1) {
    //                         return "到位";
    //                     }
    //                 }
    //             },
    //             {
    //                 field: 'kx',
    //                 title: '空闲',
    //                 sortable: true,
    //                 formatter: function (value, row, index) {
    //                     if (value == 0) {
    //                         return "未空闲";
    //                     } else if (value == 1) {
    //                         return "空闲";
    //                     }
    //                 }
    //             }
    //         ]
    //     };
    //     $('#bootstrap-table').bootstrapTable(options)
    // }


    function queryUserList2() {

        var options2 = {
            url: prefix + "/listtsj",
            height: $("#div2").height() / 1,
            modalName: "提升机",
            columns: [
                {
                    field: 'name',
                    title: '设备名称 '
                },
                {
                    field: 'rwh',
                    title: '任务号',
                    sortable: true
                },{
                    field: 'jdbz',
                    title: '阶段标志',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未开始";
                        } else if (value == 1) {
                            return "取货途中";
                        } else if (value == 2) {
                            return "取货";
                        } else if (value == 3) {
                            return "放货途中";
                        } else if (value == 4) {
                            return "放货";
                        } else if (value == 5) {
                            return "完成";
                        }
                    }
                },{
                    field: 'sbzt',
                    title: '设备状态',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(errTsjDatas, value);
                    }
                },
                {
                    field: 'yxxf',
                    title: '允许下发',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "不允许";
                        } else if (value == 1) {
                            return "允许";
                        }
                    }
                },
                // {
                //     field: 'yp',
                //     title: '源排',
                //     sortable: true
                // },
                // {
                //     field: 'yl',
                //     title: '源列',
                //     sortable: true
                // },
                // {
                //     field: 'yc',
                //     title: '源层',
                //     sortable: true
                // },
                // {
                //     field: 'mbp',
                //     title: '目标排',
                //     sortable: true
                // },
                // {
                //     field: 'mbl',
                //     title: '目标列',
                //     sortable: true
                // },
                // {
                //     field: 'mbc',
                //     title: '目标层',
                //     sortable: true
                // },
                {
                    field: 'tptm',
                    title: '托盘条码',
                    sortable: true
                }
            ]
        };
        $('#bootstrap-table2').bootstrapTable(options2)
    }
    function queryUserList1() {

        var options1 = {
            url: prefix + "/rkRgv",
            height: $("#div1").height() / 1,
            modalName: "入库RGV",
            columns: [
                {
                    field: 'name',
                    title: '设备名称 '
                },
                {
                    field: 'zxrwh',
                    title: '工位1任务号',
                    sortable: true
                },
                {
                    field: 'zxrwhs',
                    title: '工位2任务号',
                    sortable: true
                },
                // {
                //     field: 'zxjd',
                //     title: '工位1执行阶段',
                //     sortable: true
                // },
                // {
                //     field: 'zxjds',
                //     title: '工位2执行阶段',
                //     sortable: true
                // },
                {
                    field: 'czfs',
                    title: '操作方式',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未知";
                        } else if (value == 1) {
                            return "手动";
                        } else if (value == 2) {
                            return "自动";
                        }
                    }
                },{
                    field: 'sbzt',
                    title: '设备状态',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(errRgvDatas, value);
                    }
                },
                {
                    field: 'yp',
                    title: '工位1源排',
                    sortable: true
                },
                {
                    field: 'yl',
                    title: '工位1源列',
                    sortable: true
                },
                {
                    field: 'mbp',
                    title: '工位1目标排',
                    sortable: true
                },
                {
                    field: 'mbl',
                    title: '工位1目标列',
                    sortable: true
                },
                {
                    field: 'yps',
                    title: '工位2源排',
                    sortable: true
                },
                {
                    field: 'yls',
                    title: '工位2源列',
                    sortable: true
                },
                {
                    field: 'mbps',
                    title: '工位2目标排',
                    sortable: true
                },
                {
                    field: 'mbls',
                    title: '工位2目标列',
                    sortable: true
                },
                {
                    field: 'yxxf',
                    title: '允许下发',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "不允许";
                        } else if (value == 1) {
                            return "允许";
                        }
                    }
                }
            ]
        };
        $('#bootstrap-table1').bootstrapTable(options1)
    }

    function queryUserList3() {

        var options3 = {
            url: prefix + "/list4c",
            height: $("#div3").height() / 1,
            modalName: "线体输送机",
            columns: [
                {
                    field: 'devName',
                    title: '设备名字 '
                },
                {
                    field: 'taskNo',
                    title: '任务号',
                    sortable: true
                },
                {
                    field: 'dw',
                    title: '到位',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未到位";
                        } else if (value == 1) {
                            return "到位";
                        }
                    }
                },
                {
                    field: 'kx',
                    title: '空闲',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未空闲";
                        } else if (value == 1) {
                            return "空闲";
                        }
                    }
                }
            ]
        };
        $('#bootstrap-table3').bootstrapTable(options3)
    }
    function queryUserList4() {

        var options4 = {
            url: prefix + "/list5c",
            height: $("#div4").height() / 1,
            modalName: "线体输送机",
            columns: [
                {
                    field: 'devName',
                    title: '设备名字 '
                },
                {
                    field: 'taskNo',
                    title: '任务号',
                    sortable: true
                },
                {
                    field: 'dw',
                    title: '到位',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未到位";
                        } else if (value == 1) {
                            return "到位";
                        }
                    }
                },
                {
                    field: 'kx',
                    title: '空闲',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未空闲";
                        } else if (value == 1) {
                            return "空闲";
                        }
                    }
                }
            ]
        };
        $('#bootstrap-table4').bootstrapTable(options4)
    }
</script>
</body>
</html>
